import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/guild_flow_entity.dart';

GuildFlowEntity $GuildFlowEntityFromJson(Map<String, dynamic> json) {
  final GuildFlowEntity guildFlowEntity = GuildFlowEntity();
  final List<GuildFlowList>? list = (json['list'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<GuildFlowList>(e) as GuildFlowList)
      .toList();
  if (list != null) {
    guildFlowEntity.list = list;
  }
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    guildFlowEntity.total = total;
  }
  return guildFlowEntity;
}

Map<String, dynamic> $GuildFlowEntityToJson(GuildFlowEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['list'] = entity.list?.map((v) => v.toJson()).toList();
  data['total'] = entity.total;
  return data;
}

extension GuildFlowEntityExt on GuildFlowEntity {
  GuildFlowEntity copyWith({
    List<GuildFlowList>? list,
    int? total,
  }) {
    return GuildFlowEntity()
      ..list = list ?? this.list
      ..total = total ?? this.total;
  }
}

GuildFlowList $GuildFlowListFromJson(Map<String, dynamic> json) {
  final GuildFlowList guildFlowList = GuildFlowList();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    guildFlowList.id = id;
  }
  final String? outin = jsonConvert.convert<String>(json['outin']);
  if (outin != null) {
    guildFlowList.outin = outin;
  }
  final double? drnAmount = jsonConvert.convert<double>(json['drnAmount']);
  if (drnAmount != null) {
    guildFlowList.drnAmount = drnAmount;
  }
  final String? featureTitle = jsonConvert.convert<String>(
      json['featureTitle']);
  if (featureTitle != null) {
    guildFlowList.featureTitle = featureTitle;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    guildFlowList.type = type;
  }
  final String? createdAt = jsonConvert.convert<String>(json['createdAt']);
  if (createdAt != null) {
    guildFlowList.createdAt = createdAt;
  }
  return guildFlowList;
}

Map<String, dynamic> $GuildFlowListToJson(GuildFlowList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['outin'] = entity.outin;
  data['drnAmount'] = entity.drnAmount;
  data['featureTitle'] = entity.featureTitle;
  data['type'] = entity.type;
  data['createdAt'] = entity.createdAt;
  return data;
}

extension GuildFlowListExt on GuildFlowList {
  GuildFlowList copyWith({
    String? id,
    String? outin,
    double? drnAmount,
    String? featureTitle,
    int? type,
    String? createdAt,
  }) {
    return GuildFlowList()
      ..id = id ?? this.id
      ..outin = outin ?? this.outin
      ..drnAmount = drnAmount ?? this.drnAmount
      ..featureTitle = featureTitle ?? this.featureTitle
      ..type = type ?? this.type
      ..createdAt = createdAt ?? this.createdAt;
  }
}